import { fetchPeopleOutLists, fetchPeopleOutDetail } from '../../fetch/modules/peopleout'

const state = {
    peopleOutLists: {},
    peopleoutDetail: {}
}

const actions = {
    FETCH_PEOPLEOUT_LISTS: ({ commit, state }, opt) => {
        return fetchPeopleOutLists(opt).then(people => commit('GET_PEOPLEOUT_LISTS', { people }))
    },
    FETCH_PEOPLEOUT_DETAIL: ({ commit, state }, opt) => {
        return fetchPeopleOutDetail(opt).then(people => commit('GET_PEOPLEOUT_DETAIL_INFO', { people }))
    },

}
const mutations = {
    GET_PEOPLEOUT_LISTS: (state, { people }) => {
        state.peopleOutLists = people.data;
    },
    GET_PEOPLEOUT_DETAIL_INFO: (state, { people }) => {
        state.peopleoutDetail = people.data;
    },

}

const getters = {
    getPeopleOutLists(state) {
        return state.peopleOutLists;
    },
    getPeopleOutDetailInfo(state) {
        return state.peopleoutDetail;
    },

}

export default {
    state,
    actions,
    mutations,
    getters
}